<%--
    Document   : Register
    Created on : Sep 29, 2012, 4:34:35 PM
    Author     : MinhThang
--%>

<%@page contentType="text/html" pageEncoding="UTF-8" errorPage="error.jsp"%>
<%@page  import="org.apt.Bean.LectureEventEntities" %>
<%@page  import="com.myapp.DAO.LectureEventDao" %>
<%@page  import="org.apt.Bean.GroupPaymentEntities" %>
<%@page  import="com.myapp.DAO.GroupPaymentDao" %>
<%@page  import="java.util.List" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta name="description" content="website description" />
        <meta name="keywords" content="website keywords, website keywords" />
        <meta http-equiv="content-type" content="text/html; charset=windows-1252" />
        <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Tangerine&amp;v1#" />
        <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz" />
        <link rel="stylesheet" type="text/css" href="style/style.css" />
        <style type="text/css">
            * {font-family:Arial, Helvetica, sans-serif;
               font-size:10pt;}
            </style>
            <script type="text/javascript">
                function checkpaymentlectureEvent()
                {
                    if(document.fregister.ddlgroupPayment.value =="0")
                    {
                        alert('Plese choice a payment type!');
                        return false;
                    }
                    return true;
                }
            </script>
            <title>Register Lecture Event</title>
        </head>
        <body>
            <div>
                <%
                            int lectureEventID = Integer.parseInt(request.getParameter("id"));
                            String username = "";
                            String LectureEventName = "";
                            Cookie cookie[] = request.getCookies();
                            //Cookie cookieUser = null;
                            if (cookie != null) {
                                for (int i = 0; i < cookie.length; i++) {
                                    if (cookie[i].getName().equals("UserID")) {
                                        username = cookie[i].getValue();
                                        break;
                                    }
                                }
                            }
                            if (session.getAttribute("UserID") != null) {
                            } else {
                                out.print("<script>alert('If you is member flease login or register new member !');window.location.href='index.jsp';</script>");
                            }
                            LectureEventName = LectureEventDao.getLecturEventByID(lectureEventID).getEventName();
                            List<GroupPaymentEntities> ListGroupPayment = GroupPaymentDao.getAllCroupPayment();
                %>
                <div><%@include file="UserTemplate/Banner.jsp" %></div>
                <div id="site_content">
                    <form action="registerLectureEvent?&lectureEventID=<%=lectureEventID%>"  onsubmit="return checkpaymentlectureEvent();"  method="post"  name="fregister" id="form1">
                        <div id="content">
                            <table  class="tableRegiter" style="width: 100%">
                            <tbody>
                                <tr >
                                    <td colspan="2" align="center" class="headerTable"><h3>Register Lecture Event</h3></td>
                                </tr>
                                <tr>
                                    <td  class="leftForm">Lecture Event Name :</td>
                                    <td class="centerForm"><%=LectureEventName%>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="leftForm">Payment Type:</td>
                                    <td class="centerForm">
                                        <select name="ddlgroupPayment" id="textinput">
                                            <option value="0">------Select----</option>
                                            <%
                                                        if (ListGroupPayment != null) {
                                                            for (GroupPaymentEntities grup : ListGroupPayment) {
                                            %>
                                            <option value="<%=grup.getID()%>"><%=grup.getStyle()%></option>
                                            <%}
                                                        }%>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="leftForm"> </td>
                                    <td class="centerForm">
                                        <input id="pagestatus" type="submit" value="Ok" name="btnOk" style="width: 70px" />
                                        <input id="pagestatus" type="button" value="Back" style="width: 70px" onclick="history.go(-1)" name="btnBack" />
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </form>
                <div><%@include file="UserTemplate/MenuRight.jsp" %></div>
            </div>
            <div></div>
            <div><%@include file="UserTemplate/Footer.jsp" %></div>
        </div>
    </body>
</html>
